const multer = require('multer')

const info = multer.diskStorage({
    destination(req, file, cb) {
        cb(null, './public/img')
    },
    filename(req, file, cb) {
        let str = `${file.fieldname}-${new Date().getTime()}-${file.originalname}`
        cb(null, str)
    }
})


const goodinfo = multer.diskStorage({
    destination(req, file, cb) {
        cb(null, './public/goodimg')
    },
    filename(req, file, cb) {
        let str = `${file.fieldname}-${new Date().getTime()}-${file.originalname}`
        cb(null, str)
    }
})

const upload = multer({
    storage: info
})


const goodupload = multer({
    storage: goodinfo
})

module.exports = {
    upload,
    goodupload
}